#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>

using namespace std;
typedef long long LL;

struct stu
{
    int l;
    int r;
} f[1005];

bool cmp(stu a, stu b)
{
    return a.l * a.r < b.l * b.r;
}

int n;
vector<int> ans(1, 0);
vector<int> t(1, 1);

vector<int> mul(vector<int> &a, int b)
{
    vector<int> res;
    int t = 0;
    int len = a.size();
    for (int i = 0; i < len; i++)
    {
        t += a[i] * b;
        res.push_back(t % 10);
        t /= 10;
    }
    while (t)
    {
        res.push_back(t % 10);
        t /= 10;
    }
    return res;
}

vector<int> div(vector<int> &a, int b)
{
    vector<int> res;
    int r = 0;
    int len = a.size();
    for (int i = len - 1; i >= 0; i--)
    {
        r = 10 * r + a[i];
        if (r >= b)
        {
            res.push_back(r / b);
            r %= b;
        }
        else
        {
            res.push_back(0);
        }
    }
    vector<int> cnt;
    len = res.size();
    for (int i = len - 1; i >= 0; i--)
    {
        cnt.push_back(res[i]);
    }
    while ((cnt.back() == 0) && (cnt.size() > 1))
    {
        cnt.pop_back();
    }
    return cnt;
}

int compare(vector<int> &a, vector<int> &b)
{
    int lena = a.size(), lenb = b.size();
    if(lena != lenb) return lena - lenb;

    for(int i = lena - 1; i >= 0; i--) if(a[i] != b[i]) return a[i] - b[i];

    return 0;
}

int main()
{
    std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);

    cin >> n;
    cin >> f[0].l >> f[0].r;

    for (int i = 1; i <= n; i++)
    {
        cin >> f[i].l >> f[i].r;
    }

    sort(f + 1, f + 1 + n, cmp);

    t = mul(t, f[0].l);

    for (int i = 1; i <= n; i++)
    {
        vector<int> res = div(t, f[i].r);
        if (compare(ans, res) < 0)
        {
            ans = res;
        }
        t = mul(t, f[i].l);
    }

    int len = ans.size();
    for (int i = len - 1; i >= 0; i--)
    {
        cout << ans[i] << '\n';
    }

    return 0;
}